package com.ccloud.common.minio.config;

import com.ccloud.common.minio.properties.MinioProperties;
import com.ccloud.common.minio.service.MinioService;
import com.ccloud.common.minio.service.impl.MinioServiceImpl;
import com.ccloud.common.minio.template.MinioTemplate;
import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.SetBucketPolicyArgs;
import io.minio.errors.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

/**
 * @author chentl
 * @date 2021/10/29
 */
@Configuration
public class MinioAutoConfiguration {



    @Bean
    @ConditionalOnBean(MinioClient.class)
    public MinioTemplate getMinioTemplate() {
        return new MinioTemplate();
    }

    @Bean
    @ConditionalOnBean(MinioTemplate.class)
    public MinioService getMinioService() {
        return new MinioServiceImpl();
    }

}
